/*
 * OpenParts
 * A dynamic-loading components framework for GWT
 * Copyright (C) 2011 Christophe Bouthier  [chris{AT}binary-gastronome{DOT}fr]
 *
 * This work is partially based on work I have done at INRIA (http://www.inria.fr) 
 * in the context of the Qualipso European Project (http://qualipso.org/),
 * The work done at INRIA is Copyright (C) 2006-2011 INRIA
 *
 * This work is distributed under the LGPL version 3
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation. See the GNU
 * Lesser General Public License in LGPL.txt for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package fr.openparts.OpenParts.client.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import fr.openparts.OpenParts.client.OPProxyCommands;
import fr.openparts.OpenParts.client.OPShell;

/**
 * Marks a view factory method, that is a method that will be called by other parts to generate a view that will be displayed. Will be called when another part
 * call one of the {@link OPShell} displayViewXXX method. Before calling such a method, the other part should build a slot with the given id. Helpers method to
 * create slot and slotId can be found in {@link OPShell}.
 * <p>
 * The annotation take as mandatory parameters the name of the resource and the name of the action corresponding to this view.
 * <p>
 * A view factory takes two parameters, first of type OPParams, and second of type OPSlotProxy (representing the proxy to the slot containing this view). It
 * return a Widget. If this annotation is put on a method that doesn't have the correct signature, an UnableToCompleteException is thrown.
 * <p>
 * This view will directly receive some commands from container slot. Those commands, called proxy commands, are similar to some widget methods (like
 * setVisible() for example) and allows the slot to manipulare its embedded view a bit like a real local widget. A list of all implemented proxy commands can be
 * found in {@link OPProxyCommands}.
 * 
 * @author Christophe Bouthier [chris{AT}binary-gastronome{DOT}fr]
 * @creation.date 28 December 2009
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface OPViewFactory {

    /**
     * The name of the resource corresponding to this view.
     */
    String resourceName();

    /**
     * The name of the action corresponding to this view.
     */
    String actionName();
}
